// 1
setTimeout(() => {
    console.log('timer1');
    setTimeout(() => {
        console.log('timer3');
    }, 0)
}, 0);

setTimeout(() => {
    console.log('timer2');
}, 0);

console.log('start');

// start -> timer1 -> timer2 -> timer3


// 2
setTimeout(() => {
    console.log('timer1');
    Promise.resolve().then(() => {
        console.log('promise')
    });
}, 0);

setTimeout(() => {
    console.log('timer2');
}, 0);

console.log('start');

// start -> timer1 -> promise -> timer2

// Promise.then是微任务，它会被加入到本轮中的微任务列表，而定时器timer3是宏任务，它会被加入到下一轮的宏任务中